package com.zmn.brs.services.impl.objective.rule;

import com.zmn.brs.model.query.rule.ObjectiveRuleCustom;
import com.zmn.brs.model.query.rule.ObjectiveRuleCustomQuery;
import com.zmn.brs.persistence.interfaces.objective.rule.ObjectiveRuleDao;
import com.zmn.brs.services.interfaces.objective.rule.ObjectiveRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;



@Service
public class ObjectiveRuleServiceImpl implements ObjectiveRuleService {

    @Resource
    ObjectiveRuleDao objectiveRuleDao;

    /**
     * 查询事件下规则
     * @param query
     * @return
     */
    @Override
    public List<ObjectiveRuleCustom> listPageObjectiveRuleByQuery(ObjectiveRuleCustomQuery query){
        int count = countObjectiveRuleByQuery(query);
        query.setTotalCount(count);
        return objectiveRuleDao.listPageObjectiveRuleByQuery(query);
    }

    /**
     * 查询事件下规则
     * @param query
     * @return
     */
    @Override
    public List<ObjectiveRuleCustom> listObjectiveRuleByQuery(ObjectiveRuleCustomQuery query){
        return objectiveRuleDao.listObjectiveRuleByQuery(query);
    }

    @Override
    public Integer countObjectiveRuleByQuery(ObjectiveRuleCustomQuery query) {
        return objectiveRuleDao.countObjectiveRuleByQuery(query);
    }

}